package Z_DeadLine;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import utils.RabbitMQUtils;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author： pang-yun
 * @date： 2021-12-22 19:44
 * 功能目的 ：用于 接收死信队列的消息
 */

public class DeadConsumer02 {
    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitMQUtils.getChannel();
        DeliverCallback deliverCallback=(consumerTag, message) -> {
            System.out.println("DeadConsumer-02: "+new String(message.getBody()));
        };
        channel.basicConsume(DeadLineConst.DEAD_QUEUE,deliverCallback,(m)->{
            System.out.println("failed!");
        });
    }
}
